package com.icinfo.cloud.provider.punish.print.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 打印标题或者内容对象
 *
 * @author Junfeng.Chen
 * @date 2024/1/15 15:49
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class TitleOrContentVo {
    /**
     * 内容
     */
    private String content;

    /**
     * 灰度 1-4 字体加粗    1普通  2加粗
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Integer weight;

    /**
     * 字体大小 1-100  1最大 、2、3最小 （部分设备支持3种以上字体大小）
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Integer size;

    /**
     * 文字位置  打印位置：1-左、2-中、3-右
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Integer textPosition;

    public TitleOrContentVo(String content) {
        this.content = content;
    }


    /**
     * 初始化标题样式
     */
    public TitleOrContentVo initTitleStyle() {
        this.weight = 2;
        this.size = 1;
        this.textPosition = 2;
        return this;
    }

    /**
     * 初始化文书号样式
     */
    public TitleOrContentVo initDocumentNumberStyle() {
        this.weight = 2;
        this.size = 2;
        this.textPosition = 3;
        return this;
    }

    /**
     * 初始化普通样式
     */
    public TitleOrContentVo initNormalStyle() {
        this.weight = 1;
        this.size = 2;
        this.textPosition = 1;
        return this;
    }
}
